﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour {

    [HideInInspector]
    public PlayerState CurrentSate;
    [HideInInspector]
    public Vector2 Move;
    [HideInInspector]
    public bool Grounded;
    [HideInInspector]
    public bool Drection;

	public void Start () {
		
	}
	
	public void Update () {
        Move = Vector2.zero;

        Move.x = Input.GetAxis("Horizontal");

        if (CurrentSate == PlayerState.Slid)
            return;

        if (Move.x > 0.01f)
        {
            if (transform.rotation.eulerAngles.y != 0)
            {
                transform.rotation = Quaternion.Euler(0, 0, 0);
                Drection = false;
            }
        }
        else if (Move.x < -0.01f)
        {
            if (transform.rotation.eulerAngles.y == 0)
            {
                transform.rotation = Quaternion.Euler(0, 180, 0);
                Drection = true;
            }
        }        
    }
}

public enum PlayerState
{
    Running,
    Idle,
    Jumping,
    Slid,
    Death
}
